<template>
  <div class="typeitem">
    <div class="part1">
      <div class="part1item" v-for="(child, index) in indexClassifyitem[0]?.children" :key="index" @click="gotosearch(child.target)">
        <img :src="child?.img" alt="" />
        <div>{{ child?.Name }}</div>
      </div>
    </div>
    <div class="part2">
      <img :src="indexClassifyitem[0]?.bagcbanner.img" alt="" style="height: 100rem; object-fit: cover; width: 100%; border-radius: 8rem;" @click="gotosearch(indexClassifyitem[0]?.bagcbanner.target)"/>
    </div>
    <div class="part3">
      <div
        class="name"
        v-for="(keyword, index) in indexClassifyitem[0]?.keywordArr"
        :key="index"
        :style="{ backgroundColor: keyword.bagColor, color: keyword.fontColor }"
        @click="gotosearch(keyword.target)"
      >
        {{ keyword.Name }}
      </div>
    </div>
    <div class="part4">
      <div
        class="part4item"
        v-for="(banner, index) in indexClassifyitem[0]?.bannerArr"
        :key="index"
        @click="gotosearch(banner.target)"
      >
        <img :src="banner?.img" alt="" />
        <div>{{ banner?.Name }}</div>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { useRouter } from 'vue-router'

import { ref } from 'vue'
let router = useRouter()
defineProps({
  indexClassifyitem: Object,
})
let gotosearch = (keyword: string) => {
  router.push({ path: '/search', query: { keyword } })
}
</script>


<style scoped lang="less">
.typeitem {
  .part1 {
    margin: 10rem 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    .part1item {
      width: 61rem;
      height: 83rem;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      div {
        font-size: 12rem;
        color: #333;
        text-align: center;
        overflow: hidden;
        text-overflow: ellipsis;
        text-wrap: nowrap;
      }
      img {
        width: 100%;
        border-radius: 8rem;
      }
    }
  }
  .part2 {
    margin: 10rem 0;
    img {
      display: block;
    }
  }
  .part3 {
    margin: 10rem 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    .name {
      width: 79rem;
      height: 28px;
      background-color: #f5f5f5;
      border-radius: 8rem;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 12rem;
      overflow: hidden;
      text-overflow: ellipsis;
      text-wrap: nowrap;
    }
  }
  .part4 {
    margin: 10rem 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    .part4item {
      width: 79rem;
      height: 103rem;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      img {
        width: 100%;
        border-radius: 10rem;
      }
      div {
        font-size: 12rem;
        color: #333;
        text-align: center;
        overflow: hidden;
        text-overflow: ellipsis;
        text-wrap: nowrap;
      }
    }
  }
}
</style>